package com.example.mentalhealth.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.mentalhealth.entities.ExamRecord;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

//考卷记录
@Mapper
public interface ExamRecordMapper extends BaseMapper<ExamRecord> {

    //查询
    List<ExamRecord> selectByQuery(@Param("examRecord") ExamRecord examRecord,
                                   @Param("startTime") LocalDateTime startTime,
                                   @Param("endTime") LocalDateTime endTime,
                                   @Param("startScore") int startScore, @Param("endScore") int endScore);
    //查询考卷记录总数
    int queryAnswerCount();

    //查询今日考卷记录总数
    int queryTodayAnswerCount();

    //查询近三日的答卷
    List<ExamRecord> getRecentAnswerData();

    //更新
    void updateScoreById(@Param("record_id") Long record_id, @Param("score") BigDecimal score);
}
